#include "imagestab.h"


ImagesTab::ImagesTab(QTableView* imgview,QWidget *parent) :
    QWidget(parent),m_imgview(imgview)
{
    QVBoxLayout* main_layout = new QVBoxLayout;
    QHBoxLayout* buttons_layout = new QHBoxLayout;

    QPushButton* add_button = new QPushButton("Load");
    QPushButton* remove_button = new QPushButton("Remove");
    QPushButton* update_button = new QPushButton("Update");

    buttons_layout->addWidget(add_button);
    buttons_layout->addWidget(remove_button);
    buttons_layout->addWidget(update_button);

    main_layout->addLayout(buttons_layout);
    main_layout->addWidget(m_imgview);
    m_imgview->horizontalHeader()->setResizeMode(QHeaderView::Stretch);

    this->setLayout(main_layout);


    connect(add_button,SIGNAL(pressed()),this,SLOT(Add()));
    connect(remove_button,SIGNAL(pressed()),this,SLOT(Delete()));
    connect(update_button,SIGNAL(pressed()),this,SLOT(Update()));
}

void ImagesTab::Add(){
    emit AddPressed();
}


void ImagesTab::Delete(){
    emit DeletePressed();
}

void ImagesTab::Update(){
    emit UpdatePressed();
}
